#ifndef uart_inc_h
#define uart_inc_h 

#include <string.h>
#include <stdlib.h>
#include "xparameters.h"

typedef unsigned char u8;
typedef unsigned short int u16;
typedef unsigned int u32;
typedef int s32;
#define UINTPTR u32


typedef struct {
	UINTPTR BaseAddress;	/* Device base address */
	u32 IsReady;		/* Device is initialized and ready */
	int InterruptPresent;	/* Are interrupts supported in h/w */
	int IsDual;		/* Are 2 channels supported in h/w */
} XGpio;


typedef struct {
	u32 Stats;		/* Component Statistics */
	UINTPTR RegBaseAddress;		/* Base address of registers */
	u32 IsReady;			/* Device is initialized and ready */

	u32 SendBuffer;
	u32 ReceiveBuffer;

	u32 RecvHandler;
	void *RecvCallBackRef;		/* Callback ref for recv handler */
	u32 SendHandler;
	void *SendCallBackRef;		/* Callback ref for send handler */
} XUartLite;


#ifndef TRUE
#  define TRUE		1U
#endif

#ifndef FALSE
#  define FALSE		0U
#endif

#ifndef NULL
#define NULL		((void*)0)
#endif

int XGpio_Initialize(XGpio * InstancePtr, u16 DeviceId);
u32 XGpio_DiscreteRead(XGpio *InstancePtr, unsigned Channel);
void XGpio_DiscreteWrite(XGpio *InstancePtr, unsigned Channel, u32 Mask);


u32 XBram_ReadReg(u32 BaseAddress, u32 RegOffset);
int XUartLite_Initialize(XUartLite *InstancePtr, u16 DeviceId);
void XUartLite_SendByte(UINTPTR BaseAddress, u8 Data);

void XUartLite_ResetFifos(XUartLite *InstancePtr);

unsigned int XUartLite_Send(XUartLite *InstancePtr, u8 *DataBufferPtr,
				unsigned int NumBytes);
unsigned int XUartLite_Recv(XUartLite *InstancePtr, u8 *DataBufferPtr,
				unsigned int NumBytes);


#endif